#!/usr/bin/env node

const http = require('http');

http.createServer((req,res)=>{
  console.log(`${req.method} ${req.url} HTTP/${req.httpVersion}`);
  console.log(req.headers);
  console.log('');

  var body = '';

  req.on('data', function(chunk) { body += chunk;  });
  req.on('end', function(){
    console.log(body);
    res.end('ok');
  });

}).listen(8080);


